module.exports = {
    configureWebpack: {
        devServer: {
            port: 8089,//端口
            open: true, //启动自动打开
            //Mock数据
            before(app) {
                let userPoor = [
                    {username: 'xiaod', password: `123456`},
                    {username: 'tim', password: `123456`}
                ];
                app.get('/api/register', (req, res) => {
                    const {username} = req.query;
                    const userLength = userPoor.filter(v => v.username === username).length;
                    if (userLength > 0) {
                        res.json(
                            {
                                success: false,
                                mes: `用户已存在`
                            }
                        )
                    } else {
                        res.json(
                            {
                                success: true,
                                mes: `注册成功`
                            }
                        )
                    }
                })
            }
        }
    },

    css: {
        loaderOptions: {
            stylus: {
                'resolve url': true,
                'import': [
                    './src/theme'
                ]
            }
        }
    },

    pluginOptions: {
        'cube-ui': {
            postCompile: true,
            theme: true
        }
    }
};
